package com.touchalachs.core;

import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.Rect;

public class CanvasTool {

	public static Rect pctToScr(int x, int y, int w, int h, Canvas canvas) {
		return pctToScr(new Rect(x, y, x+w, y+h), canvas);
	}
	
	public static Rect pctToScr(Rect rect, Canvas canvas) {
		return pctToScr(rect, new Point(canvas.getWidth(), canvas.getHeight()));
	}
	
	public static Rect pctToScr(int x, int y, int w, int h, Point screenSize) {
		return new Rect(x*screenSize.x/100, y*screenSize.y/100, (x+w)*screenSize.x/100, (y+h)*screenSize.y/100);
	}
	
	public static Rect pctToScr(Rect rect, Point screenSize) {
		return new Rect(rect.left*screenSize.x/100, rect.top*screenSize.y/100, rect.right*screenSize.x/100, rect.bottom*screenSize.y/100);
	}
}
